<template>
  <div class="itemswipe" style="margin: 5px 0;">
    <!-- 轮播图图片 -->
    <van-swipe indicator-color="blue" :autoplay="3000">
      <van-swipe-item v-for="(item, index) in items" :key="index">
        <van-image
          width="100%"
          height="200px"
          fit="contain"
          :src="'data:image;base64,' + item.images[0]"
          @click="onClick(item)"
        />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import { Swipe, SwipeItem, Image, Lazyload } from "vant"
export default {
  components: {
    [Swipe.name]: Swipe,
    [SwipeItem.name]: SwipeItem,
    [Image.name]: Image,
    [Lazyload.name]: Lazyload
  },
  data() {
    return {}
  },
  methods: {
    onClick(item) {
      this.$router.push({ name: "item", params: { item_id: item.item_id } })
    }
  },
  props: ["items"]
}
</script>
